<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        window.onload = function (){
            document.getElementById("001").onclick = function(){
            alert("牛逼！");
            var a = document.getElementsByTagName("button");
            alert(a[0].innerText);
            // 输出的是文本内容
            alert(a[0].innerHTML);
            // 输出的是包括HTML代码的文本内容
            }
        }
    </script>
</head>
<body>
    <div id="001">
        <button>确定</button>
    </div>
</body>
</html>